#include<stdio.h>
int search_num(int(*arr)[4], int row, int col, int num)
{	
	int r = 0;
	int c = col - 1;
	
	while (r < row && c >= 0)
	{
		if (arr[r][c] < num)
		{
			r++;
		}
		else if (arr[r][c] > num)
		{
			c--;
		}
		else
			return 1;
	}

	return 0;
}

int main()
{
	int arr[3][4] = { 1,2,3,4,5,6,7,8,9,10,11,12 };
	int num = 9;
	if (search_num(arr,3,4,num) == 1)
	{
		printf("true\n");
	}
	else
	{
		printf("false\n");
	}
	return 0;
}